#include "tool.h"
#include <qdebug.h>
// int Tool::numberOfThreadPool=10;
Tool* Tool::tool=new Tool(100);
Tool::Tool() {
    setMaxThreadCount(numberOfThreadPool);
// qDebug()<<"1";
}




Tool::Tool(int NOTP):numberOfThreadPool(NOTP)
{
    // databaseTool(QString ip,int port,QString dataBaseName ,QString userName,QString passWord,QObject *parent);

    // if(!databaseTool->getIsDBok())
    //     return;
    setMaxThreadCount(numberOfThreadPool);
    // KTcpTool=new tcpTool(this);
    // KTcpTool->setDb(databaseTool->getDb());
}

int Tool::getNumberOfThreadPool() const
{
    return numberOfThreadPool;
}

void Tool::setNumberOfThreadPool(int newNumberOfThreadPool)
{
    numberOfThreadPool = newNumberOfThreadPool;
    setMaxThreadCount(numberOfThreadPool);
}

void Tool::setMaxThreadCount(int threadCount)
{
    QThreadPool::globalInstance()->setMaxThreadCount(numberOfThreadPool);
}





Tool *Tool::getStaticTool()
{
    return tool;
}

databaseTool *Tool::getDatabaseTool() const
{
    return databaseTool;
}


void Tool::setDatabaseTool(class databaseTool* newDatabaseTool)
{
    databaseTool = newDatabaseTool;
}

tcpTool *Tool::getKTcpTool() const
{
    return KTcpTool;
}

void Tool::setKTcpTool(tcpTool *newKTcpTool)
{
    KTcpTool = newKTcpTool;
}



